﻿using UnityEngine;
using System.Collections;

public class PantallaInfoCloud : MonoBehaviour {

	// Use this for initialization
	public GUIStyle styleBox;
	public GUIStyle styleVolver;
	public GUIStyle stylePaginaWeb;
	public GUIStyle styleLabel;
	public GUIStyle styleTextArea1;
	private Rect caja;
	private Rect cajaVolver;
	private Rect cajaVolverPaginaWeb;
	private Rect cajaLabel1;
	private Rect cajaLabel2;
	private Rect cajaLabel3;
	private Rect cajaLabel4;
	private Rect cajaLabel5;
    public Transform CloudRecoTarget; 
	public Transform CloudRecognition;
	private CloudRecoTrackableEventHandler cloudRecoTrackableEventHandler;
	private CloudRecoEventHandler cloudRecoEventHandler;
	
//	 	   public string stringToEdit = "";
	void Start () {

	   cloudRecoTrackableEventHandler=CloudRecoTarget.GetComponent<CloudRecoTrackableEventHandler>();
	   cloudRecoEventHandler=CloudRecognition.GetComponent<CloudRecoEventHandler>();	
	   this.redimensionarPantalla();

	}
	
	// Update is called once per frame
	void Update () {
	this.redimensionarPantalla();
}
	
	void OnGUI() {

		   
		if(cloudRecoTrackableEventHandler.getFlagScreen()){
			GUI.Box(caja,"", styleBox);
//			 stringToEdit = GUI.TextArea(new Rect(10, 10, 200, 100), "Periodico de la Provincia de Jujuy,su gran tiradadiaria llega hasta el ultimo rincon de la provincia. En esto mementos genera 10.000 puesto de trabajo en toda la privincia", 200,styleTextArea1);
		
 			 GUI.Label (cajaLabel1, "NOMBRE:\n"+cloudRecoEventHandler.getEmpresa().getNombre(),styleLabel);			
			 GUI.Label (cajaLabel2, "DIRECCION:\n"+cloudRecoEventHandler.getEmpresa().getDireccion(),styleLabel);
			 GUI.Label (cajaLabel3, "MAIL:\n"+cloudRecoEventHandler.getEmpresa().getMail(),styleLabel);
      		 GUI.Label (cajaLabel5, "INFORMACION DE INTERES:\n"+cloudRecoEventHandler.getEmpresa().getInformacionInterez(),styleLabel);
			 GUI.Label (cajaLabel4, "TELEFONO:\n"+cloudRecoEventHandler.getEmpresa().getTelefono(),styleLabel);
      		 GUI.Label (cajaLabel5, "INFORMACION DE INTERES:\n"+cloudRecoEventHandler.getEmpresa().getInformacionInterez(),styleLabel);
//			 GUI.Label (cajaLabel5, "INFORMACION DE INTERES:\nPeriodico de la Provincia de Jujuy,su gran tirada diaria llega hasta el ultimo rincon de la provincia. En esto mementos genera 10.000 puesto de trabajo en toda la privincia",styleLabel);
			 if (GUI.Button(cajaVolver,"",styleVolver)){
                cloudRecoTrackableEventHandler.setFlagScren(false);
			}
			 if (GUI.Button(cajaVolverPaginaWeb,"",stylePaginaWeb)){
                Application.OpenURL(cloudRecoEventHandler.getEmpresa().getUrl());
			}
			
		}	
	}

  
	void redimensionarPantalla(){
		caja=new Rect(0,0,Screen.width,Screen.height);
		cajaVolver=new Rect(Screen.width-5*Screen.width/100-40*Screen.width/100,Screen.height-3*Screen.height/100-15*Screen.width/100,40*Screen.width/100,15*Screen.width/100);
		cajaVolverPaginaWeb=new Rect(5*Screen.width/100,Screen.height-3*Screen.height/100-15*Screen.width/100,40*Screen.width/100,15*Screen.width/100);
	
		cajaLabel1=new Rect(5*Screen.width/100,10*Screen.height/100,Screen.width,5*Screen.height/100);
		cajaLabel2=new Rect(5*Screen.width/100,22*Screen.height/100,Screen.width-5*Screen.width/100,5*Screen.height/100);
		cajaLabel3=new Rect(5*Screen.width/100,34*Screen.height/100,Screen.width-5*Screen.width/100,5*Screen.height/100);
		cajaLabel4=new Rect(5*Screen.width/100,46*Screen.height/100,Screen.width-5*Screen.width/100,5*Screen.height/100);
		cajaLabel5=new Rect(5*Screen.width/100,58*Screen.height/100,Screen.width-5*Screen.width/100,5*Screen.height/100);
		styleLabel.fontSize=((int) 2*Screen.height/100);
	}

}
